package cn.client.ui.components

import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.NavigationBar
import androidx.compose.material3.NavigationBarItem
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.res.stringResource
import cn.client.navigation.destinations.AppDestination

/**
 * 底部导航栏
 */
@Composable
fun AppBottomBar(
    allScreens: List<AppDestination>,
    onTabSelected: (AppDestination) -> Unit,
    currentScreen: AppDestination
) {

    NavigationBar(
        containerColor = MaterialTheme.colorScheme.surfaceVariant
    ) {
        allScreens.forEach { screen ->
            NavigationBarItem(
                icon = { Icon(imageVector = screen.icon,contentDescription = null)},
                label = { Text(text = stringResource(screen.label)) },
                selected = currentScreen == screen,
                onClick = { onTabSelected(screen) },
            )
        }
    }
}





//    /* 首页 */
//    NavigationBarItem(
//        icon = {
//            Icon(
//                imageVector = Icons.Default.Home,
//                contentDescription = null
//            )
//        },
//        label = {
//            Text(
//                text = stringResource(R.string.bottom_navigation_dynamic)
//            )
//        },
//        selected = true,
//        onClick = {}
//    )
//    /* 聊天 */
//    NavigationBarItem(
//        icon = {
//            Icon(
//                imageVector = Icons.Default.ChatBubbleOutline,
//                contentDescription = null
//            )
//        },
//        label = {
//            Text(
//                text = stringResource(R.string.bottom_navigation_msg)
//            )
//        },
//        selected = false,
//        onClick = {}
//    )
//    /* 我的 */
//    NavigationBarItem(
//        icon = {
//            Icon(
//                imageVector = Icons.Default.AccountCircle,
//                contentDescription = null
//            )
//        },
//        label = {
//            Text(
//                text = stringResource(R.string.bottom_navigation_myself)
//            )
//        },
//        selected = false,
//        onClick = {}
//    )
//}
//@Preview(showBackground = true)
//@Composable
//fun AppBottomPreview(){
//    // Scaffold 自动调整布局
//        Scaffold(
//            topBar = { AppTopBar() },
//            bottomBar = { AppBottomBar() }
//        ) { padding ->
//            DynamicScreen(Modifier.padding(padding))
//        }
//
//}